package com.zks.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zks.dao.UserDao;
import com.zks.model.User;
import com.zks.service.UserService;
import com.zks.util.returnData.OpenResponse;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


@Service(value = "userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;


    @Override
    public OpenResponse<User> login(User user) {
        User user11=userDao.selectById(1);

        QueryWrapper <User> ew = new QueryWrapper();
        ew.ne("id",1);

       List<User> user1=userDao.selectList(ew);

        User u = null;
        List<User> list = new ArrayList();
        u = userDao.login(user);
        OpenResponse<User> result = new OpenResponse();
        if (u != null) {
            result.setCode(0);
            result.setMessage("登陆成功！");
            result.setData(u);
        } else {
            result.setCode(1);
            result.setMessage("登陆失败！");
        }
        return result;

    }
}
